import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)


const routes = [
  {
    path: '/',
    name: '',
    redirect: '/login',
  },
  {
    path: '/layout',
    name: 'Layout',
    redirect: '/BuyParkingSpace',
    component: () => import('./views/Layout.vue'),
    children:[
      {
        path: '/BuyParkingSpace',
        component: () => import( './components/BuyParkingSpace.vue'),
      },
      {
        path: '/AlreadyParkingSpace',
        component: () => import( './components/AlreadyParkingSpace.vue'),
      },
      {
        path: '/OrderInformation',
        component: () => import( './components/OrderInformation.vue'),
      },
      {
        path: '/Coupons',
        component: () => import( './components/Coupons.vue'),
      },
    ]
  },
  {
    path: '/adminLayout',
    name: 'AdminLayout',
    redirect: '/userManage',
    component: () => import('./views/AdminLayout.vue'),
    children:[
      {
        path: '/userManage',
        component: () => import( './components/admin/UserManage.vue'),
      },
      {
        path: '/villageManage',
        component: () => import( './components/admin/VillageManage.vue'),
      },
      {
        path: '/estateManage',
        component: () => import( './components/admin/EstateManage.vue'),
      },
      {
        path: '/parkingManage',
        component: () => import( './components/admin/ParkingManage.vue'),
      },
      {
        path: '/orderManage',
        component: () => import( './components/admin/OrderManage.vue'),
      },
      {
        path: '/couponManage',
        component: () => import( './components/admin/CouponManage.vue'),
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('./views/Login.vue'),
    meta: {
      title: '登录'
    }
  }
]

const router = new Router({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})



export default router;
